package com.dotflat.physicalevaluate.domain.pe;

import com.matt.commons.model.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * 测量标准
 */
@Data
@Entity
@Table(name = "pe_measure")
@EqualsAndHashCode(callSuper = false)
public class Measure extends Domain implements Serializable {


//    @Column(columnDefinition = "INT DEFAULT 0 COMMENT '测评类型'")
//    private Integer evaluate;

    @Column(columnDefinition = "varchar(32) DEFAULT 0 COMMENT '测评维度ID'")
    private String dimensionId;

    @Column(columnDefinition = "INT DEFAULT 0 COMMENT '性别'")
    private Integer gender;

    @Column(columnDefinition = "INT DEFAULT 0 COMMENT '限定条件低'")
    private Integer reserveLow;

    @Column(columnDefinition = "INT DEFAULT 0 COMMENT '限定条件高'")
    private Integer reserveHigh;

    @Column(name = "unit",columnDefinition = "varchar(10) DEFAULT 0 COMMENT '单位'", nullable = false)
    private String unit;

    @Column(columnDefinition = "INT DEFAULT 0 COMMENT '测试结果低'")
    private Integer measureLow;

    @Column(columnDefinition = "INT DEFAULT 0 COMMENT '测试结果高'")
    private Integer measureHigh;

    @Column(name = "val", nullable = false)
    private String value;

    @Column(name = "rankVal", columnDefinition = "INT DEFAULT 0 COMMENT '得分'", nullable = false)
    private Integer rank;

    @Column(name = "remark")
    private String remark;

    @Column(columnDefinition = "varchar(500) COMMENT '通过结论' ")
    private String passResult;

    @Column(columnDefinition = "varchar(500) COMMENT '不通过结论' ")
    private String failResult;

    @Column(columnDefinition = "varchar(500) COMMENT '提升建议' ")
    private String advise;

    public static Measure of(String dimensionId, Integer gender, Integer reserveLow, Integer reserveHigh, String unit, Integer measureLow, Integer measureHigh, String value, Integer rank){
        Measure ret = new Measure();

        ret.setDimensionId(dimensionId);
        ret.setGender(gender);
        ret.setReserveLow(reserveLow);
        ret.setReserveHigh(reserveHigh);
        ret.setUnit(unit);
        ret.setMeasureLow(measureLow);
        ret.setMeasureHigh(measureHigh);
        ret.setValue(value);
        ret.setRank(rank);

        return ret;
    }
}